<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="encontrarDatos.aspx.cs" Inherits="WAContratos.general.encontrarDatos" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Consultando...</title>

<link rel="STYLESHEET" type="text/css" href="../js/dhtmlGRID/codebase/dhtmlxgrid.css">
<link rel="stylesheet" type="text/css" href="../js/dhtmlGRID/codebase/skins/dhtmlxgrid_dhx_skyblue.css">
<link rel="STYLESHEET" type="text/css" href="../js/dhtmlGRID/codebase/dhtmlxcalendar.css">

<script  src="../js/dhtmlGRID/codebase/dhtmlxcommon.js"></script>
<script  src="../js/dhtmlGRID/codebase/dhtmlxgrid.js"></script>        
<script  src="../js/dhtmlGRID/codebase/dhtmlxgridcell.js"></script>    

<script  src="../js/dhtmlGRID/codebase/Calen/dhtmlxcalendar.js"></script>    
<script  src="../js/dhtmlGRID/codebase/excells/dhtmlxgrid_excell_dhxcalendar.js"></script>
<script src="../js/dhtmlGRID/codebase/ext/dhtmlxgrid_validation.js" type="text/javascript" charset="utf-8"></script>
<link rel="stylesheet" href="../js/dhtmlGRID/codebase/dhtmlx_validation.css" type="text/css" media="screen" title="no title" charset="utf-8">

<script  src="../js/dhtmlGRID/codebase/excells/dhtmlxgrid_excell_cntr.js"></script>
<script  src="../js/dhtmlGRID/codebase/ext/dhtmlxgrid_splt.js"></script>
<script  src="../js/dhtmlGRID/codebase/dhtmlxdataprocessor.js"></script>
<script  src="../js/dhtmlGRID/codebase/ext/dhtmlxgrid_nxml.js"></script>
<script  src="../js/dhtmlGRID/codebase/excells/dhtmlxgrid_excell_link.js"></script>
<script  src="../js/dhtmlGRID/codebase/ext/dhtmlxgrid_pgn.js"></script>
<script  src="../js/dhtmlGRID/codebase/ext/dhtmlxgrid_filter.js"></script>    

<style type="text/css" >
	 .btnCrm
	 { width:84px; height:22px; 
	   border-left:#6699CC thin solid; border-bottom:#4167B0 thin solid;
	   border-right:#6699CC thin solid; border-top:#4167B0 thin solid; 
	   background-image: -moz-linear-gradient(top, #B9D5EF, #D0E5F7);
	   background-image: -webkit-gradient(linear,left bottom,left top,color-stop(0, #D0E5F7),color-stop(1, #B9D5EF));
	   filter:  progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#B9D5EF', endColorstr='#D0E5F7'); 
	   font:Tahoma; font-size:11px;  
	 }
	 
	 #button:active { 
	position:relative; 
	top:1px /* or more */ 
	} 
.Estilo4 {
	font-family: Tahoma;
	font-size: 10px;
	font-weight: bold;
}
.Estilo6 {
	font-family: Tahoma;
	font-size: 12px;
	font-weight: bold;
}
.Estilo7 {
	font-size: 12px;
	font-family: Geneva, Arial, Helvetica, sans-serif;
}
.Estilo10 {font-family: Tahoma}
</style>

</head>

<body>

<form name="frmDatos" id="frmDatos" enctype="multipart/form-data" runat="server">
<fieldset style="width:540px">
<legend><span class="Estilo6">Consulta</span></legend>
<span class="Estilo4">Columna :</span> 
<select id='a10'>
    <option value='1'><%=colum1%></option>
    <option value='2'><%=colum2%></option>
</select>
<span class="Estilo4">Ingr. Texto :</span>
<input type="text" name="a12" value="" id="a12">
<input type="button" name="a11" value="Buscar" id="a11" onclick='myDatosGrid.filterBy(document.getElementById("a10").value,document.getElementById("a12").value);'>


<textarea id="txtCampo1" name="txtCampo1" style="width:600px;height:100px;display:none"
          cols="" rows=""></textarea>
<textarea id="txtCampo2" name="txtCampo2" style="width:600px;height:100px;display:none"
          cols="" rows=""></textarea>
<textarea id="str_xmlGrid" name="str_xmlGrid" style="width:600px;height:100px; visibility:hidden; display:none"
          rows="" cols=""></textarea>
		  
<textarea id="XMLGrid" name="XMLGrid" style="width:600px;height:100px; visibility:hidden; display:none"
rows="3" cols="4"></textarea>

<textarea id="nomCampo1" name="nomCampo1" style="width:600px;height:100px;display:none"
rows="3" cols="4"><%=nomCampo1%></textarea>
<textarea id="nomCampo2" name="nomCampo2" style="width:600px;height:100px;display:none"
rows="3" cols="4"><%=nomCampo2%></textarea>


</fieldset>
<br id="brMensaje"/>

					<table id="mensajePos" cellSpacing=0 cols=0 cellPadding=0 style=" width:150px; height:26px; background-color:#FFFFAE; border-top: #C5C5C5 1px solid; border-bottom:#C5C5C5 1px solid; border-right:#C5C5C5 1px solid; border-left:#C5C5C5 1px solid;">
					    <tr>
			  		<td style="width:5px" noWrap>
							<img src="../images/loading.gif">					  </td>
					  
							<td width="84%">
							<span class="style6 Estilo4 Estilo7" id="spanMensaje"><span class="style6  Estilo10" id="spanMensaje">Cargando.....</span></span>							</td>
						</tr>
					</table>				   
				
				   
<table width="570px">
    <tr>
        <td id="recinfoArea"></td>
    </tr>
    <tr>
        <td>
            <div id="gridbox" style="width:100%;height:200px;background-color:white;overflow:hidden"></div>
			            
			            <script>
							//init grid and set its parameters (this part as always)
							
							myDatosGrid = new dhtmlXGridObject('gridbox');
							myDatosGrid.setImagePath("../js/dhtmlGRID/codebase/imgs/");
							myDatosGrid.setColumnIds("A, codigo,descripcion");
							myDatosGrid.setHeader("&nbsp;,<%=nombre1%>,<%=nombre2%>");
							myDatosGrid.setInitWidths("50,<%=ancho%>,370")
							myDatosGrid.setColAlign("right,<%=alienacion%>,left")
							myDatosGrid.setColTypes("cntr,ro,ro");
							myDatosGrid.setSkin("dhx_skyblue");
							myDatosGrid.setColSorting("int,str,str")
							myDatosGrid.init();
							myDatosGrid.loadXML("consuXmlDatos.aspx");	//used just for demo purposes
							
						</script>
        </td>
    </tr>
    <tr>
        <td id="pagingArea"></td>
        
        <input type="hidden" id="tipo" value="<%=tipo%>">
    </tr>
</table>
<table style="width:570px">
  <tr>
  <td align="center">
	 <!--<input type="button" name="a11Acept-->	 
      <asp:Button ID="btnAceptar" runat="server" CssClass="btnCrm" 
          onclick="btnAceptar_Click" OnClientClick="aceptar()" Text="Aceptar" />
       <input type="button" name="a11Cancelar" id="a11Cancelar" value="Cancelar" 
          onclick="cerrarVentana()" class="btnCrm"/>
      <asp:HiddenField ID="hdCodProceso" runat="server" />
	  <asp:HiddenField ID="htCoDProceso" runat="server" />
	</td>
</tr>
</table>
<script>

var myArrayGrids;
var basePath = '';
		
		setTimeout('document.getElementById(\'mensajePos\').style.visibility=\'hidden\';',1000);
		setTimeout('document.getElementById(\'mensajePos\').style.display=\'none\';',1000);
		setTimeout('document.getElementById(\'brMensaje\').style.visibility=\'hidden\';',1000);
		setTimeout('document.getElementById(\'brMensaje\').style.display=\'none\';',1000);

	function cerrarVentana()
	{	  
	  window.close();
	}
	
	function aceptar()
	{
		var fila = myDatosGrid.getSelectedId();
		opcion = myDatosGrid.cells(fila,1).getValue(); 
		
		document.getElementById('hdCodProceso').value = opcion;
		
		opcion1 = myDatosGrid.cells(fila,2).getValue(); 
		
		var tipo = document.getElementById('tipo').value;
		
		if(tipo=='0')
		{
		    var obtCampo1 = document.getElementById('nomCampo1').value;
		    var obtCampo2 = document.getElementById('nomCampo2').value;
    		
		    var parentText = window.opener.document.getElementById(obtCampo1);
		    parentText.value = opcion;
    		
    		
		    var parentText = window.opener.document.getElementById(obtCampo2);
		    parentText.value = opcion1;
		}else
		{
		    var obtCampo2 = document.getElementById('nomCampo2').value;
    	    var parentText = window.opener.document.getElementById(obtCampo2);
    	    
    	    if(parentText.value!= '')
    	    {
		        parentText.value = parentText.value + ';' + opcion1;
		    }else{
		        parentText.value = parentText.value + opcion1;
		    }
		}
		
		
	}
	
	
			
</script>

</form>
</body>
</html>
